//
//  GWEmotionKeybordView.m
//  新浪微博
//
//  Created by qianfeng on 16/2/20.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWEmotionKeybordView.h"
#import "GWEmotionListView.h"
#import "GWEmotionToolBar.h"
#import "GWEmotion.h"
#import "GWEmotionTool.h"
@interface GWEmotionKeybordView ()<GWEmotionToolBarDelegate>
@property (nonatomic,weak)GWEmotionListView *listView;
@property (nonatomic,weak)GWEmotionToolBar *emotionToolView;



@end
@implementation GWEmotionKeybordView

+(instancetype)keybord
{
    return [[self alloc]init];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self =[super initWithFrame:frame]) {
        
        //1.表情view
        GWEmotionListView *listView =[[GWEmotionListView alloc]init];
        [self addSubview:listView];
        self.listView =listView;
        
        //2.工具view
        GWEmotionToolBar *emotionToolView =[[GWEmotionToolBar alloc]init];
        [self addSubview:emotionToolView];
        self.emotionToolView =emotionToolView;
        emotionToolView.delegate =self;
       
    }
    return self;
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    self.emotionToolView.width =GWScreenW;
    self.emotionToolView.height =35;
    self.emotionToolView.y =self.height-self.emotionToolView.height;
    
    self.listView.width =GWScreenW;
    self.listView.height =self.emotionToolView.y;
   
}

-(void)emotionToolBar:(GWEmotionToolBar *)toolBar didSelectedBtn:(GWEmotionType)btnType
{
    
    switch (btnType) {
            
        case GWEmotionTypeDefault:
            self.listView.emotionSource =[GWEmotionTool defaultEmotions];
            break;
        case GWEmotionTypeEmoji:
            self.listView.emotionSource =[GWEmotionTool emojiEmotions];
            break;
        case GWEmotionTypeLxh:
            self.listView.emotionSource =[GWEmotionTool xlhEmotions];
            break;
        case GWEmotionTypeRecent:
            self.listView.emotionSource =[GWEmotionTool recentEmotions];
            break;
    }
}

@end
